package com.enba.mall.core.orders.order.resp;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
import lombok.Data;

@ApiModel("订单详情-出参")
@Data
public class OrderDetailResp {

  @ApiModelProperty("订单id")
  private Long id;

  @ApiModelProperty("下单事件")
  private LocalDateTime date;

  @ApiModelProperty("订单状态")
  private String status;

  @ApiModelProperty("支付方式")
  private String paymentMethod;

  @ApiModelProperty("订单总额")
  private BigDecimal totalAmount;

  @ApiModelProperty("运费")
  private BigDecimal shippingFee;

  @ApiModelProperty("优惠金额")
  private BigDecimal discount;

  @ApiModelProperty("实际支付金额")
  private BigDecimal finalAmount;

  @ApiModelProperty("用户信息")
  private UserResp user;

  @ApiModelProperty("商品信息")
  private List<ProductResp> products;

  @ApiModelProperty("物流信息")
  private LogisticsResp logistics;

  @ApiModelProperty("优惠券信息")
  private List<CouponResp> coupons;

  @Data
  public static class UserResp {
    @ApiModelProperty("用户名")
    private String name;

    @ApiModelProperty("联系电话")
    private String phone;

    @ApiModelProperty("收货地址")
    private String address;
  }

  @Data
  public static class ProductResp {
    @ApiModelProperty("skuId")
    private Long id;

    @ApiModelProperty("商品名称")
    private String title;

    @ApiModelProperty("商品规格")
    private String spec;

    @ApiModelProperty("商品价格")
    private BigDecimal price;

    @ApiModelProperty("商品数量")
    private Integer count;

    @ApiModelProperty("商品图片")
    private String image;
  }

  @Data
  public static class LogisticsResp {
    @ApiModelProperty("物流公司")
    private String company;

    @ApiModelProperty("物流单号")
    private String trackingNumber;

    @ApiModelProperty("发货时间")
    private LocalDateTime shippedTime;

    @ApiModelProperty("运输时间")
    private LocalDateTime inTransitTime;
  }

  @Data
  public static class CouponResp {
    @ApiModelProperty("优惠券名称")
    private String name;

    @ApiModelProperty("优惠金额")
    private BigDecimal value;

    @ApiModelProperty("优惠券码")
    private String code;
  }
}
